package main

import (
    "fmt"
    "github.com/go-redis/redis"
)

func main() {
    fmt.Println("golang连接redis")

    var Info1 Info
    Info1.add="127.0.0.2:6379"
    Info1.pw="123456"

    client := redis.NewClient(&redis.Options{
        Addr: Info1.add,
        Password: Info1.pw,
        DB: 0,
    })

    pong, err := client.Ping().Result()
    fmt.Println(pong, err)

}

type Info struct{
    add string
    pw string
}
